<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://unpkg.com/vue@next"></script>
    <title>Document</title>
</head>

<body>
    <div id="root"></div>
</body>
<script>
    const app = Vue.createApp({
        setup() {
            const { ref, reactive } = Vue
            const inputval = ref('')
            const list = reactive([])
            const handleinput = (e) => {
                inputval.value = e.target.value
            }
            const hanleClick = () => {
                list.push(inputval.value)
            }
            return {
                list,
                inputval,
                handleinput,
                hanleClick
            }
        },
        template: `<div>
            <div>
            <input :value="inputval" @input="handleinput"/>
            <button @click="hanleClick">提交</button>
            </div>
            <ul>
            <li v-for="(item,index) in list" :key="index">{{item}}</li>        
            </ul>
            </div>`,
    })
    const vm = app.mount('#root')
</script>

</html>